package cn.lg.feignclient;

import cn.lg.domain.Course;
import cn.lg.util.AjaxResult;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

/**
 * @ProjectName springcloud_netflix_parent
 * @ClassName MoveFeignFallBackFactory
 * @Description TODO
 * @Author Administrator
 * @Date 2022/5/31 23:01
 * @Version 1.0
 **/
@Component
@Slf4j
public class SourseFeignFallBackFactory implements FallbackFactory<cn.lg.feignclient.SourseFeignClient> {

    @Override
    public cn.lg.feignclient.SourseFeignClient create(Throwable throwable) {
        log.info("服务调用异常");
        return new cn.lg.feignclient.SourseFeignClient() {

            @Override
            public AjaxResult addOrUpdateMove(Course course) {
                System.out.println(AjaxResult.error().setMsg("系统繁忙，请稍后重试"));
                return AjaxResult.error().setMsg("系统繁忙，请稍后重试");
            }

            @Override
            public Course getOneMove(Long id) {
                return null;
            }
        } ;
    }
}
